package org.journal.entity;

// Generated Dec 18, 2014 11:06:01 AM by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * AuthoritiesEntity generated by hbm2java
 */
@NamedQueries(value = { @NamedQuery(name = "AuthoritiesEntity.getUserAuthorities", query = "Select auth from AuthoritiesEntity auth where userEntity=:userEntity") })
@Entity
@Table(name = "authorities", catalog = "journal")
public class AuthoritiesEntity implements java.io.Serializable {

	private int idAuthorities;
	private UserEntity userEntity;
	private String authority;

	public AuthoritiesEntity() {
	}

	public AuthoritiesEntity(int idAuthorities, UserEntity userEntity) {
		this.idAuthorities = idAuthorities;
		this.userEntity = userEntity;
	}

	public AuthoritiesEntity(int idAuthorities, UserEntity userEntity,
			String authority) {
		this.idAuthorities = idAuthorities;
		this.userEntity = userEntity;
		this.authority = authority;
	}

	public AuthoritiesEntity(UserEntity userEntity, String authority) {
		this.userEntity = userEntity;
		this.authority = authority;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_authorities", unique = true, nullable = false)
	public int getIdAuthorities() {
		return this.idAuthorities;
	}

	public void setIdAuthorities(int idAuthorities) {
		this.idAuthorities = idAuthorities;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_user", nullable = false)
	public UserEntity getUserEntity() {
		return this.userEntity;
	}

	public void setUserEntity(UserEntity userEntity) {
		this.userEntity = userEntity;
	}

	@Column(name = "authority", length = 45, nullable = false)
	public String getAuthority() {
		return this.authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

}
